<script setup lang="ts">
// * 指 插件下的所有模块，包括，柱状、折现、饼图等等
// as 取别名为 echart 
import * as ec from 'echarts'
import { onMounted } from 'vue';

console.log("我是setup")


//vue的声明周期函数 Mount 挂载/加载
// 等template 渲染完成之后生效
onMounted(() => {
    console.log("我是onMounted")

    // echart 初始化
    let myChart = ec.init(document.getElementById('div_chart'));
    myChart.setOption({
        //图表的标题栏的设置
        title: {
            text: '柱状图演示'
        },
        tooltip: {
            // type: "scroll",
            show: false
        },
        xAxis: {
            data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
        },
        yAxis: {
            show: false
        },
        series: [
            {
                name: '销量',
                type: 'line',
                data: [5, 20, 36, 10, 10, 20]
            }
        ],
        // 图例
        legend: {
            type: "plain",
            show: false
        }
    });
})

</script>

<template>
    <div id="div_chart"></div>
</template>

<style scoped></style>